package com.xiaohudie.thread;

/**
 * @Author xiao hu die
 * @Date 2022/2/21 11:54
 * @Version 1.0
 */
public class Test07 {
    public static void main(String[] args) {
        Thread07 thread07 = new Thread07();
        Thread thread = new Thread(thread07);
        thread.start();
        try {
            Thread.sleep(1000*5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        thread07.isOff =false;
    }
static  class Thread07 implements Runnable {
    boolean isOff = true;
    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            if (isOff) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(i);
            }else {
                return;
            }
            }
    }
}
}

